home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Controls
/
Visual Basic Controls.iso
/
vbcontrol
/
axnteven
/
frwriter.frm
< prev
next >
Wrap
Text File
|
1999-03-29
|
4KB
|
158 lines
VERSION 5.00
Object = "{97746B1E-E2AE-11D2-9A51-00000100C2E6}#1.0#0"; "AxEvntLg.ocx"
Begin VB.Form FrmWriter
Caption = "Event writer"
ClientHeight = 3795
ClientLeft = 60
ClientTop = 345
ClientWidth = 4590
LinkTopic = "Form1"
ScaleHeight = 3795
ScaleWidth = 4590
StartUpPosition = 3 'Windows Default
Begin AxEvntLg.AxNTEventLog NTEventLogX
Left = 1380
Top = 1200
MachineName = ""
SourceName = "Application"
Active = 0 'False
BackupFileName = ""
IncludeUserName = -1 'True
End
Begin VB.CheckBox cbxInclude
Caption = "Include User name"
Height = 255
Left = 1260
TabIndex = 8
Top = 2520
Width = 2175
End
Begin VB.CommandButton btnFull
Caption = "Write message"
Height = 375
Left = 60
TabIndex = 7
Top = 3360
Width = 4455
End
Begin VB.CommandButton btnSimple
Caption = "Write simple message"
Height = 375
Left = 60
TabIndex = 6
Top = 2880
Width = 4455
End
Begin VB.ComboBox cmbEventType
Height = 315
Left = 1260
Style = 2 'Dropdown List
TabIndex = 4
Top = 2100
Width = 3255
End
Begin VB.TextBox memStrings
Height = 1155
Left = 60
MultiLine = -1 'True
TabIndex = 3
Top = 840
Width = 4455
End
Begin VB.ComboBox cmbComputer
Height = 315
Left = 1260
Style = 2 'Dropdown List
TabIndex = 0
Top = 120
Width = 3255
End
Begin VB.Label Label3
Caption = "Event Type"
Height = 255
Left = 120
TabIndex = 5
Top = 2160
Width = 915
End
Begin VB.Label Label2
Caption = "Text to write"
Height = 195
Left = 120
TabIndex = 2
Top = 600
Width = 975
End
Begin VB.Label Label1
Caption = "Computer"
Height = 255
Left = 120
TabIndex = 1
Top = 180
Width = 915
End
End
Attribute VB_Name = "FrmWriter"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub btnFull_Click()
NTEventLogX.MachineName = cmbComputer.Text
NTEventLogX.Active = True
EventType = 1
For i = 0 To cmbEventType.ListIndex - 1
EventType = EventType * 2
Next i
Set WriteObject = NTEventLogX.WriteObject
WriteObject.EventId = 1000
WriteObject.EventType = EVT_ERROR
WriteObject.EventCategory = 2
WriteObject.Strings.Text = memStrings.Text
WriteObject.DataBytes.Clear
For i = 0 To 3
WriteObject.DataBytes.Add (i)
Next i
Call NTEventLogX.AddObject(WriteObject)
NTEventLogX.Active = False
End Sub
Private Sub btnSimple_Click()
NTEventLogX.MachineName = cmbComputer.Text
NTEventLogX.Active = True
EventType = 1
For i = 0 To cmbEventType.ListIndex - 1
EventType = EventType * 2
Next i
Call NTEventLogX.Add(EventType, memStrings.Text)
NTEventLogX.Active = False
End Sub
Private Sub cbxInclude_Click()
NTEventLogX.IncludeUserName = Not (cbxInclude.Value = 0)
End Sub
Private Sub Form_Load()
Set List = NTEventLogX.GetServers("")
For i = 0 To List.Count - 1
cmbComputer.AddItem (List.Item(i))
Next i
cmbEventType.AddItem ("SUCCESS")
cmbEventType.AddItem ("ERROR")
cmbEventType.AddItem ("WARNING")
cmbEventType.AddItem ("Information")
cmbEventType.AddItem ("AUDIT_SUCCESS")
cmbEventType.AddItem ("AUDIT_FAILURE")
cmbEventType.ListIndex = 0
End Sub